if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[UrlDictionaryEntryCreate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].UrlDictionaryEntryCreate
GO

CREATE PROCEDURE [dbo].[UrlDictionaryEntryCreate]
	@key varchar(50),
	@value varchar(300),
	@newUrl bit = 0
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	
	IF (@newUrl = 1)
	BEGIN
		INSERT INTO [UrlDictionary]
			   ([UrlKey],
			    [UrlValue],
				[NewUrlValue])
		 VALUES
			   (@key,
			    '',
				@value)
	END
	ELSE
	BEGIN
		INSERT INTO [UrlDictionary]
			   ([UrlKey],
				[UrlValue])
		 VALUES
			   (@key,
				@value)
	END

END